<?PHP
$login = $_GET['log'];
$cle = $_GET['cle'];
include "./php/url.php";
include_once "php/ini.php";
dbconnect();

$query = "SELECT * FROM users WHERE nom_user = '".$login."';";
$result = mysql_query($query);

if (!$result)
{
    echo "SQL error : ", $query;
    exit ;
}
else
{

    while ($tab = mysql_fetch_assoc($result))
    {
        if ($tab['cle'] == $cle)
        {
            $sql = "UPDATE `citu_infinity`.`users` SET `compte_active` = '1' WHERE `users`.`id_user` = '".$tab['id_user']."' LIMIT 1 ;";
			
            $requete = mysql_query($sql);
            if (!$requete)
            {
                echo "SQL error : ", $sql;
                exit ;
            }
            else
            {
                echo "Merci, ".$login.", de votre inscription sur Infinity. <br /> <a href='".$url."' title='Infinity'>Retour au site.</a>";
            }
        }
        else
        {
            echo "Une erreur est survenue, désolé.";
        }
    }

}

dbclose();
?>
